<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>


<h2 class="formHeader" id="accountFormHeader">Your Account Details</h2>

<form:form method="POST" commandName="accountForm"
	action="/film_rental/user/account/return" id="accountForm">
	<table id="accountFormTable" class="formTable">
		<c:if test="${paidRentals.size() > 0}">
			<tr id="accountFormTableHeader" class="formRow">
				<td colspan="2" class="formCell"><h3>Rented Film</h3></td>
				<td class="formCell"><h3>Rental Date</h3></td>
			</tr>
		</c:if>


		<c:if test="${paidRentals.size() == 0}">
			<tr id="accountEmptyRow" class="formRow">
				<td id="accountEmpty" class="formCell">You have no outstanding
					film rentals. <a href="/film_rental/user/search">Search for
						films here</a> <a href="/film_rental/user/cart">Rent films in your
						cart.</a>
				</td>
				</td>
			</tr>
		</c:if>

		<c:forEach items="${paidRentals}" var="rental">
			<c:url value="/films/listings" var="filmListing">
				<c:param name="id" value="${rental.inventory.film.filmId}"></c:param>
			</c:url>
			<tr class="formRow">
				<td class="formCell"><form:checkbox path="rentalsToReturn"
						value="${rental.rentalId}" />
				<td class="formCell"><a href="${filmListing}"><c:out
							value="${rental.inventory.film.title}"></c:out></a></td>
				<td class="formCell"><c:out value="${rental.rentalDate}" /></td>
			</tr>
		</c:forEach>
		<c:if test="${paidRentals.size() > 0}">
			<tr id="accountFormSubmitRow" class="formRow">

				<td colspan="3" class="formCell"><input type="submit"
					value="Return Selected Films" class="formButton" /></td>

			</tr>
		</c:if>

	</table>
</form:form>
